﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;


namespace UscSunShine.Models
{
    /// <summary>
    /// 公告\办事流程
    /// </summary>
    public class Post
    {
        public Post()
        {
            this.InputDate = DateTime.Now;
            this.ViewTimes = 1;
            this.PostCategory = PostCategory.通知公告;
        }
        /// <summary>
        /// 办事机构
        /// </summary>
        public virtual Department Department { get; set; }
        /// <summary>
        /// 办事机构ID
        /// </summary>
        [Display(Name = "办事机构")]
        public int DepartmentID { get; set; }

        public int ID { get; set; }


        /// <summary>
        /// 标题
        /// </summary>
        [Required(ErrorMessage="请填写标题")]
        [Display(Name = "标题")]     
        [StringLength(250)]
        public string Title { get; set; }


        /// <summary>
        /// 正文
        /// </summary>
        [Required(ErrorMessage="请填写正文")]
        [Display(Name = "正文")]
        [AllowHtml]
        public string Content { get; set; }


        /// <summary>
        /// 录入时间
        /// </summary>
        [Display(Name = "录入时间")]
        [DataType(DataType.Date, ErrorMessage = "日期格式：2014-02-08")]
        public DateTime InputDate { get; set; }


        /// <summary>
        /// 点击次数
        /// </summary>
        [Required]
        [Display(Name = "点击次数")]
        [Range(1, 100000)]
        public int ViewTimes { get; set; }


        /// <summary>
        /// 公告类别
        /// </summary>
        [Required(ErrorMessage="请选择类别")]
        [Display(Name = "公告类别")]
        public PostCategory PostCategory { get; set; }

    }
}
